package pers.fulsun.blog.entity;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.InnerField;
import org.springframework.data.elasticsearch.annotations.MultiField;

/**
 * (article)ES实体类
 *
 * @author fl
 * @since 2021-11-29 11:19:42
 * @description 由 Mybatisplus Code Generator 创建
 */
@Data
@Document(indexName = "article", shards = 3, replicas = 1, createIndex = true)
public class EsArticle implements Serializable {
  @Transient private static final long serialVersionUID = 1L;

  /** 主键id */
  @Id private Integer id;
  /** 作者id */
  @Field(type = FieldType.Integer)
  private Integer userid;
  /** 文章分类id */
  @Field(type = FieldType.Integer)
  private Integer cid;
  /** 文章缩略图 */
  //  @Field(type = FieldType.Keyword, index = false)
  private String articlecover;
  /** 标题 */
  @MultiField(
      mainField = @Field(type = FieldType.Text, analyzer = "ik_max_word"),
      otherFields = {@InnerField(suffix = "keyword", type = FieldType.Keyword)})
  private String title;
  /** 内容 */
  @Field(type = FieldType.Text, analyzer = "ik_max_word")
  private String mdContent;
  /** 是否为草稿（0-否 1-是） */
  @Field(type = FieldType.Integer)
  private Integer isdraft;
  /** 是否置顶（0-否 1-是） */
  @Field(type = FieldType.Integer)
  private Integer istop;
  /** 创建时间 */
  @Field(type = FieldType.Keyword)
  private Date createtime;
  /** 创建人 */
  @Field(type = FieldType.Keyword)
  private String createby;
  /** 更新时间 */
  @Field(type = FieldType.Date, format = DateFormat.basic_date_time)
  private Date updatetime;
  /** 修改人 */
  @Field(type = FieldType.Keyword)
  private String updateby;
  /** 状态码（0-否 1-是） */
  @Field(type = FieldType.Integer)
  private Integer isdelete;

  @Field(type = FieldType.Text)
  private String[] dynamicTags;
}
